< previous page page_73 next page >

Page 73
Table 3.3. The controls for the Database.vbp project.
ControlPropertySetting
FormCaptionDatabase Objects Demo
WindowStateMaximize
DataControlAlignmentAlign Bottom
DatabaseName"BOOKS5.MDB"
RecordSourceAuthors

Be sure to place the data control at the very bottom of the form. It is only there to give you access to the various database properties that you print on the form itself. Enter the program code in Listing 3.15 in the Form_Activate event.
Type.gifListing 3.15. Listing Database objects.
Private Sub Form_Activate()
    '
    ' show high-level database objects
    '
    Dim tb As TableDef
    Dim fl As Field
    Dim ix As Index

    Data1.DatabaseName = App.Path & "\..\..\data\books5.mdb"
    Data1.Refresh
    '
    For Each tb In Data1.Database.TableDefs
        Me.Print "Table Info:"
        Print " "; tb.Name
        For Each fl In tb.Fields
            Print " -"; fl.Name
        Next
        MsgBox "Press OK to continue"
        Me.Cls
    Next
    '
    On Error Resume Next ' in case there's no index
    '
    For Each tb In Data1.Database.TableDefs
        Me.Print "Index Info:"
        Print " "; tb.Name
        For Each ix In tb.Indexes
            Print " -"; ix.Name;
            Print "[";
            Print ix.Fields;
            Print "]"
continues

 
< previous page page_73 next page >

If you like this book, buy it!